<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Verb Phrases</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.12.4.min.js"
	integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>

<script src="../docs-assets/Bigfoot.js"></script>
<link href="../docs-assets/Bigfoot.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Verb Phrases' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../services.html">Services</a></li><li><a href="index.html">linguistics</a></li><li><a href="index.html#4">Chapter 4: Diagramming Sentences</a></li><li><b>Verb Phrases</b></li></ul></div>
<p class="purpose">To construct verb-phrase subtrees for assertion sentences.</p>

<ul class="toc"><li><a href="4-vp.html#SP1">&#167;1. Seeking verbs</a></li><li><a href="4-vp.html#SP9">&#167;9. Sidekick nonterminals</a></li><li><a href="4-vp.html#SP12">&#167;12. Corrective surgery</a></li><li><a href="4-vp.html#SP16">&#167;16. Called surgery</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Seeking verbs.</b>The nonterminal &lt;sentence&gt; has to find the verb in a sentence, and find its
noun phrases, with no contextual knowledge at all. In a sentence with only
one plausible verb, this is not difficult: the verb in "Anna is a sailor"
must be "is". But suppose we have:
</p>

<blockquote>
    <p>The Fisher-Price carry cot is a container.</p>
</blockquote>

<p class="commentary">Is the verb "carry" or "is"? A human reader will more likely judge that a
particular make of cot is being said to be a container (thus "is"), rather
than that, say, a progressive rock band called "The Fisher-Price" are
carrying copies of their new EP of remixed lullabies, "cot is a container".
</p>

<p class="commentary">But a human has to know a great deal about culture and society to make
this sort of judgement. How is &lt;sentence&gt; to do it? One answer might be to
recognise "the Fisher-Price carry cot" as something already known, having
been defined in an earlier sentence. But Inform does not require such
pre-declarations &mdash; indeed, the above sentence is a legal way to create
the cot from nothing.
</p>

<p class="commentary">Instead, &lt;sentence&gt; has to use heuristic rules about what is most likely,
and the algorithm below is the product of a very great deal of experimentation.
</p>

<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>There are two variant forms: &lt;sentence&gt; and &lt;sentence-without-occurrences&gt;.
Inform actually uses the latter, detecting adverbs of occurrence like "for
the third time" lower down in the compiler.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> Either way, <a href="4-vp.html#SP5" class="internal">VerbPhrases::seek</a>
does the work.<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup>
</p>

<ul class="footnotetexts"><li class="footnote" id="fn:1"><p class="inwebfootnote"><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> This reduces false negatives, usually involving ambiguity between "time",
the kind of value, and "time", the measure of how often something has happened.
<a href="#fnref:1" title="return to text"> &#x21A9;</a></p></li><li class="footnote" id="fn:2"><p class="inwebfootnote"><sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> Between 2010 and early 2016, this was implemented in straight Preform
rather than as an internal. This was more satisfying to read but became just
too complicated to maintain once VSO verbs were added to the grammar.
<a href="#fnref:2" title="return to text"> &#x21A9;</a></p></li></ul>
<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;sentence&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><a href="4-vp.html#SP5" class="function-link"><span class="function-syntax">VerbPhrases::seek</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">XP</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-vp.html#SP12" class="function-link"><span class="function-syntax">VerbPhrases::corrective_surgery</span></a><span class="plain-syntax">(*</span><span class="identifier-syntax">XP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Trace diagram</span><span class="named-paragraph-number">2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="function-syntax">&lt;sentence-without-occurrences&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><a href="4-vp.html#SP5" class="function-link"><span class="function-syntax">VerbPhrases::seek</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">XP</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="4-vp.html#SP12" class="function-link"><span class="function-syntax">VerbPhrases::corrective_surgery</span></a><span class="plain-syntax">(*</span><span class="identifier-syntax">XP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Trace diagram</span><span class="named-paragraph-number">2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Trace diagram</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">RESULTS_VP_TRACE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Sentence subtree:\n"</span><span class="plain-syntax">); </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">N</span><span class="plain-syntax"> = *</span><span class="identifier-syntax">XP</span><span class="plain-syntax">; </span><span class="identifier-syntax">N</span><span class="plain-syntax">; </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="identifier-syntax">N</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"$T"</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG_OUTDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"No verb found\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP2">&#167;2</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b></p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">SEEK_VP_TRACE</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">VIABILITY_VP_TRACE</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">RESULTS_VP_TRACE</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">SURGERY_VP_TRACE</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::tracing</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::tracing</span></span>:<br/><a href="4-vp.html#SP2_1">&#167;2.1</a>, <a href="4-vp.html#SP5">&#167;5</a>, <a href="4-vp.html#SP5_3_1_1_1_2">&#167;5.3.1.1.1.2</a>, <a href="4-vp.html#SP5_3_1_1_1_3_4">&#167;5.3.1.1.1.3.4</a>, <a href="4-vp.html#SP15">&#167;15</a>, <a href="4-vp.html#SP16">&#167;16</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRACING_LINGUISTICS_CALLBACK</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRACING_LINGUISTICS_CALLBACK</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifndef</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRACING_LINGUISTICS_CALLBACK</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>The following shows two simple sentences parsed with tracing on:
</p>

<pre class="undisplayed-code all-displayed-code code-font">
<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">beth</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">sailor</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'beth is a sailor'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">    -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] -- -- </span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Found</span><span class="plain-syntax"> </span><span class="identifier-syntax">usage</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="identifier-syntax">tier</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">: (</span><span class="identifier-syntax">beth</span><span class="plain-syntax">) </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) (</span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">sailor</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Accepted</span><span class="plain-syntax"> </span><span class="identifier-syntax">as</span><span class="plain-syntax"> </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) + </span><span class="identifier-syntax">___</span><span class="plain-syntax"> + </span><span class="identifier-syntax">___</span>
<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">succeeded:</span><span class="plain-syntax"> </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">}</span>

<span class="identifier-syntax">Sentence</span><span class="plain-syntax"> </span><span class="identifier-syntax">subtree:</span>
<span class="plain-syntax">    </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'beth'</span>
<span class="plain-syntax">    </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'sailor'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">indefinite</span><span class="plain-syntax"> </span><span class="character-syntax">'a'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">}</span>
<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">carried</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> </span><span class="identifier-syntax">anna</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase is carried by anna'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">    -- -- -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] </span><span class="identifier-syntax">carried</span><span class="plain-syntax">[1] -- -- </span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Found</span><span class="plain-syntax"> </span><span class="identifier-syntax">usage</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="identifier-syntax">tier</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">: (</span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax">) </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) (</span><span class="identifier-syntax">carried</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> </span><span class="identifier-syntax">anna</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Accepted</span><span class="plain-syntax"> </span><span class="identifier-syntax">as</span><span class="plain-syntax"> </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) + </span><span class="identifier-syntax">carried</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> + </span><span class="identifier-syntax">___</span>
<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">succeeded:</span><span class="plain-syntax"> </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is carried by'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">} {</span><span class="identifier-syntax">prep1:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carried</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax">}</span>

<span class="identifier-syntax">Sentence</span><span class="plain-syntax"> </span><span class="identifier-syntax">subtree:</span>
<span class="plain-syntax">    </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is carried by'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">} {</span><span class="identifier-syntax">prep1:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carried</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'ming vase'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">indefinite</span><span class="plain-syntax"> </span><span class="character-syntax">'a'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="character-syntax">'is carried by'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">meaning:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carries</span><span class="plain-syntax">}</span>
<span class="plain-syntax">        </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'anna'</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>The following function is only recursive to at most one level. It's used either
to parse a whole sentence, or is called from within itself to deal with the
object phrase part of an existential sentence where the SP is defective.
In the latter case, the call parameter <span class="extract"><span class="extract-syntax">existential_OP_edge</span></span> will be the word
number of the last word which can be safely considered as a possible
preposition.
</p>

<p class="commentary">For example, here is a case where recursion occurs and succeeds:
</p>

<pre class="undisplayed-code all-displayed-code code-font">
<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">there</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'there is a ming vase which is on the table'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">    -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] -- -- -- -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] -- -- -- </span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Found</span><span class="plain-syntax"> </span><span class="identifier-syntax">usage</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="identifier-syntax">tier</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">: (</span><span class="identifier-syntax">there</span><span class="plain-syntax">) </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) (</span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">which</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase which is on the table'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] -- -- -- </span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Found</span><span class="plain-syntax"> </span><span class="identifier-syntax">usage</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="identifier-syntax">tier</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">: (</span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">which</span><span class="plain-syntax">) </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) (</span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Accepted</span><span class="plain-syntax"> </span><span class="identifier-syntax">as</span><span class="plain-syntax"> </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) + </span><span class="identifier-syntax">on</span><span class="plain-syntax"> + </span><span class="identifier-syntax">___</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">succeeded:</span><span class="plain-syntax"> </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is on'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">} {</span><span class="identifier-syntax">prep1:</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax">}</span>

<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">succeeded:</span><span class="plain-syntax"> </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is on'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">} {</span><span class="identifier-syntax">prep1:</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax">} {</span><span class="identifier-syntax">existential</span><span class="plain-syntax">}</span>

<span class="identifier-syntax">Sentence</span><span class="plain-syntax"> </span><span class="identifier-syntax">subtree:</span>
<span class="plain-syntax">    </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is on'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">} {</span><span class="identifier-syntax">prep1:</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax">} {</span><span class="identifier-syntax">existential</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'ming vase'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">indefinite</span><span class="plain-syntax"> </span><span class="character-syntax">'a'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="character-syntax">'is on'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">meaning:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carries</span><span class="plain-syntax">}</span>
<span class="plain-syntax">        </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'table'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">definite</span><span class="plain-syntax"> </span><span class="character-syntax">'the'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">/</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax">}</span>
</pre>
<p class="commentary">And here is a case where recursion is tried but does not provide the solution,
so that we have to soldier on regardless:
</p>

<pre class="undisplayed-code all-displayed-code code-font">
<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">there</span><span class="plain-syntax"> </span><span class="identifier-syntax">is</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'there is a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">    -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] -- -- -- -- -- -- -- -- -- </span><span class="identifier-syntax">of</span><span class="plain-syntax">[1] -- </span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Found</span><span class="plain-syntax"> </span><span class="identifier-syntax">usage</span><span class="plain-syntax">, </span><span class="identifier-syntax">pass</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax"> </span><span class="identifier-syntax">tier</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">: (</span><span class="identifier-syntax">there</span><span class="plain-syntax">) </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) (</span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- -- -- -- -- -- -- -- </span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">failed</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- -- -- -- -- -- -- -- </span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">failed</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- -- -- -- -- -- -- -- </span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">failed</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- -- -- -- -- -- -- -- </span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">failed</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- -- -- -- -- -- -- -- </span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">failed</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- -- -- -- -- -- -- -- </span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">failed</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> </span><span class="identifier-syntax">ming</span><span class="plain-syntax"> </span><span class="identifier-syntax">vase</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> | </span><span class="identifier-syntax">called</span><span class="plain-syntax"> </span><span class="identifier-syntax">the</span><span class="plain-syntax"> </span><span class="identifier-syntax">table</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="identifier-syntax">having</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'a ming vase on the table called the table of having'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">            -- -- -- -- -- -- -- -- -- -- -- </span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">failed</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Accepted</span><span class="plain-syntax"> </span><span class="identifier-syntax">as</span><span class="plain-syntax"> </span><span class="identifier-syntax">be</span><span class="plain-syntax">(0) + </span><span class="identifier-syntax">on</span><span class="plain-syntax"> + </span><span class="identifier-syntax">___</span>
<span class="identifier-syntax">Seek</span><span class="plain-syntax"> </span><span class="identifier-syntax">succeeded:</span><span class="plain-syntax"> </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">} {</span><span class="identifier-syntax">prep1:</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax">} {</span><span class="identifier-syntax">existential</span><span class="plain-syntax">}</span>

<span class="identifier-syntax">Sentence</span><span class="plain-syntax"> </span><span class="identifier-syntax">subtree:</span>
<span class="plain-syntax">    </span><span class="constant-syntax">VERB_NT</span><span class="character-syntax">'is'</span><span class="plain-syntax"> {</span><span class="reserved-syntax">verb</span><span class="plain-syntax"> </span><span class="character-syntax">'be'</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax"> </span><span class="identifier-syntax">act</span><span class="plain-syntax"> </span><span class="identifier-syntax">IS_TENSE</span><span class="plain-syntax"> +</span><span class="identifier-syntax">ve</span><span class="plain-syntax">} {</span><span class="identifier-syntax">prep1:</span><span class="plain-syntax"> </span><span class="identifier-syntax">on</span><span class="plain-syntax">} {</span><span class="identifier-syntax">existential</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'ming vase'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">indefinite</span><span class="plain-syntax"> </span><span class="character-syntax">'a'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="character-syntax">'is'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">meaning:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carries</span><span class="plain-syntax">}</span>
<span class="plain-syntax">        </span><span class="constant-syntax">CALLED_NT</span><span class="character-syntax">'called'</span>
<span class="plain-syntax">            </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'table'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">definite</span><span class="plain-syntax"> </span><span class="character-syntax">'the'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">/</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax">}</span>
<span class="plain-syntax">            </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'table of having'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">definite</span><span class="plain-syntax"> </span><span class="character-syntax">'the'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">/</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax">}</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::seek</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::seek</span></span>:<br/><a href="4-vp.html#SP2">&#167;2</a>, <a href="4-vp.html#SP5_3_1_1_1_3_1">&#167;5.3.1.1.1.3.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> **</span><span class="identifier-syntax">XP</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">detect_occurrences</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SEEK_VP_TRACE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Seek verb in: %W | %W\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax">+1));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Seek verb in: %W\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">); </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><a href="4-vp.html#SP5" class="function-link"><span class="function-syntax">VerbPhrases::seek_inner</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">XP</span><span class="plain-syntax">, </span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax">, </span><span class="identifier-syntax">detect_occurrences</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SEEK_VP_TRACE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG_OUTDENT</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rv</span><span class="plain-syntax">) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Seek succeeded: $T\n"</span><span class="plain-syntax">, *</span><span class="identifier-syntax">XP</span><span class="plain-syntax">); </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Seek failed\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::seek_inner</span><span class="plain-syntax">(</span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> **</span><span class="identifier-syntax">XP</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">detect_occurrences</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="constant-syntax">VIABILITY_MAP_SIZE</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">Calculate the viability map</span><span class="named-paragraph-number">5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">VIABILITY_VP_TRACE</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_2" class="named-paragraph-link"><span class="named-paragraph">Log the viability map</span><span class="named-paragraph-number">5.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3" class="named-paragraph-link"><span class="named-paragraph">Seek verb usages</span><span class="named-paragraph-number">5.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>The "viability map" assigns a score to each word in the sentence. Here
are some example viability maps:
</p>

<pre class="undisplayed-code all-displayed-code code-font">
<span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'anna is a know all'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">-- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] -- </span><span class="identifier-syntax">know</span><span class="plain-syntax">[1] -- </span>
<span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'the soldier knows that ( this is true ) they do not carry rifles'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">-- -- </span><span class="identifier-syntax">knows</span><span class="plain-syntax">[1] -- -- -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[2] -- -- -- </span><span class="reserved-syntax">do</span><span class="plain-syntax">[3] </span><span class="identifier-syntax">not</span><span class="plain-syntax">[3] </span><span class="identifier-syntax">carry</span><span class="plain-syntax">[3] -- </span>
<span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'the solomon islands does not have an air force ( this is true )'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">-- -- -- </span><span class="identifier-syntax">does</span><span class="plain-syntax">[3] </span><span class="identifier-syntax">not</span><span class="plain-syntax">[3] </span><span class="identifier-syntax">have</span><span class="plain-syntax">[3] -- -- -- -- -- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[2] -- -- </span>
<span class="identifier-syntax">viability</span><span class="plain-syntax"> </span><span class="identifier-syntax">map</span><span class="plain-syntax"> </span><span class="identifier-syntax">of</span><span class="plain-syntax"> </span><span class="character-syntax">'velma is not a thinker'</span><span class="plain-syntax">:</span>
<span class="plain-syntax">-- </span><span class="identifier-syntax">is</span><span class="plain-syntax">[1] -- -- -- </span>
</pre>
<p class="commentary">The scoring system is:
</p>

<ul class="items"><li>(a) Words definitely not part of a verb score 0 and are marked <span class="extract"><span class="extract-syntax">--</span></span> above.
</li><li>(b) Verb words outside brackets score 1, and inside brackets 2, except that
</li><li>(c) Words which are part of a negated verb other than "to be" score 3.
</li></ul>
<p class="commentary">The viability map contains occasional false positives (i.e., words having positive
score which should be zero), but never has false zeroes.
</p>

<p class="commentary">The following does not impose a size limit on sentences; it is only that parsing
is less efficient on sentences longer than this number of words. A sentence whose
primary verb does not appear in its first hundred words is a rarity.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">VIABILITY_MAP_SIZE</span><span class="plain-syntax"> </span><span class="constant-syntax">100</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b>Rule (c) is there so that we do not trip up on auxiliary verbs such as "does"
or "have" in "does not have".
</p>

<p class="commentary">The copular verb "to be" is exempt so that something like "Velma is not a
thinker" can be parsed as "(Velma) is (not a thinker)", allowing "not a thinker"
to be a noun phrase &mdash; if "thinker" is an either/or property with a single possible
antonym &mdash; "doer", let's say &mdash; then we want to construe this sentence as if
it read "Velma is a doer".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Calculate the viability map</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">Wordings::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="constant-syntax">VIABILITY_MAP_SIZE</span><span class="plain-syntax">); </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bl</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_WORDING</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax"> == </span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">) == </span><span class="identifier-syntax">OPENBRACKET_V</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">) == </span><span class="identifier-syntax">OPENBRACE_V</span><span class="plain-syntax">)) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CLOSEBRACKET_V</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">) == </span><span class="identifier-syntax">CLOSEBRACE_V</span><span class="plain-syntax">)) </span><span class="identifier-syntax">bl</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> - </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">VIABILITY_MAP_SIZE</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">NTI::test_vocabulary</span><span class="plain-syntax">(</span><span class="identifier-syntax">Lexer::word</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">), </span><span class="function-syntax">&lt;nonimperative-verb&gt;</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bl</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pos_to</span><span class="plain-syntax"> = -(</span><span class="function-syntax">&lt;negated-noncopular-verb-present&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos_to</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">pos</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos_to</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">pos</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">VIABILITY_MAP_SIZE</span><span class="plain-syntax">) </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="constant-syntax">3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">pos</span><span class="plain-syntax">++, </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">pos</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] == </span><span class="constant-syntax">1</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] == </span><span class="constant-syntax">2</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> - </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;pre-verb-rc-marker&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_2" class="paragraph-anchor"></a><b>&#167;5.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Log the viability map</span><span class="named-paragraph-number">5.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"viability map of '%W':\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_WORDING</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> - </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">VIABILITY_MAP_SIZE</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"%W[%d] "</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wordings::one_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">), </span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"-- "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3" class="paragraph-anchor"></a><b>&#167;5.3. </b>We are in fact interested only in word positions with viability 1 or 2, and
in practice viability 2 positions are very unlikely to be correct, so we
will first make every effort to match a verb at a viability 1 position.
(Why do we allow viability 2 matches at all? Really just so that we can
report them as problems.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Seek verb usages</span><span class="named-paragraph-number">5.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">viability_level</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">viability_level</span><span class="plain-syntax"> &lt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">; </span><span class="identifier-syntax">viability_level</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1" class="named-paragraph-link"><span class="named-paragraph">Seek verb usages at this viability level</span><span class="named-paragraph-number">5.3.1</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1" class="paragraph-anchor"></a><b>&#167;5.3.1. </b>Within that constraint, we check in two passes. On pass 1, we skip over any
verb usage which might be part of a relative clause, in that it's preceded
by a relative clause marker; on pass 2, should we ever get that far, this
restriction is lifted. Thus for example in the sentence
</p>

<blockquote>
    <p>A man who does not carry an octopus is happy.</p>
</blockquote>

<p class="commentary">we would skip over the words of "does not carry" on pass 1 because they are
preceded by "who". The reason we go on to pass 2 is not that relative clauses
are ever allowed here: they aren't. It's that we might have misunderstood
the relative clause marker. For example, in
</p>

<blockquote>
    <p>Telling it that is gossipy behaviour.</p>
</blockquote>

<p class="commentary">the "that" doesn't introduce a relative clause; "telling it that" is a
well-formed noun phrase.
</p>

<p class="commentary">Within each pass, we try each priority tier in turn (except the priority 0
tier, which is never allowed). Within each tier, we look for the leftmost
position of the current viability at which a verb usage occurs, and if two
such occur at the same position, we take the longer (or if they are of
equal length, the earliest defined).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Seek verb usages at this viability level</span><span class="named-paragraph-number">5.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pass</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">pass</span><span class="plain-syntax"> &lt;= </span><span class="constant-syntax">2</span><span class="plain-syntax">; </span><span class="identifier-syntax">pass</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">verb_usage_tier</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">first_search_tier</span><span class="plain-syntax">; </span><span class="identifier-syntax">tier</span><span class="plain-syntax">; </span><span class="identifier-syntax">tier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">tier</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_tier</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">tier</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">priority</span><span class="plain-syntax"> != </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LOOP_THROUGH_WORDING</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> - </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">j</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">VIABILITY_MAP_SIZE</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">viable</span><span class="plain-syntax">[</span><span class="identifier-syntax">j</span><span class="plain-syntax">] == </span><span class="identifier-syntax">viability_level</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                        </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1" class="named-paragraph-link"><span class="named-paragraph">Seek verb usage at position pos</span><span class="named-paragraph-number">5.3.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3">&#167;5.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1" class="paragraph-anchor"></a><b>&#167;5.3.1.1. </b>At this point <span class="extract"><span class="extract-syntax">TW</span></span> is the tail of the wording: its first word is what we
think might be the verb. For example, given
</p>

<blockquote>
    <p>The coral snake is in the green bucket.</p>
</blockquote>

<p class="commentary">we might have <span class="extract"><span class="extract-syntax">TW</span></span> being "is in the green bucket".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Seek verb usage at position pos</span><span class="named-paragraph-number">5.3.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">TW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">verb_usage</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vu</span><span class="plain-syntax"> = </span><span class="identifier-syntax">tier</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tier_contents</span><span class="plain-syntax">; </span><span class="identifier-syntax">vu</span><span class="plain-syntax">; </span><span class="identifier-syntax">vu</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vu</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_within_tier</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Consider whether this usage is being made at this position</span><span class="named-paragraph-number">5.3.1.1.1</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1">&#167;5.3.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1. </b>We must test whether our verb usage appears at the front of <span class="extract"><span class="extract-syntax">TW</span></span>, though for
efficiency's sake we first test whether the verb has a meaning. (There are
potentially a great many meaningless verbs, because of the way adaptive text
is handled in Inform.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Consider whether this usage is being made at this position</span><span class="named-paragraph-number">5.3.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vi</span><span class="plain-syntax"> = </span><a href="3-vu.html#SP12" class="function-link"><span class="function-syntax">VerbUsages::get_verb</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vu</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">ISW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">, </span><span class="identifier-syntax">IOW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> = </span><span class="constant-syntax">UNKNOWN_CE</span><span class="plain-syntax">, </span><span class="identifier-syntax">pre_certainty</span><span class="plain-syntax"> = </span><span class="constant-syntax">UNKNOWN_CE</span><span class="plain-syntax">, </span><span class="identifier-syntax">post_certainty</span><span class="plain-syntax"> = </span><span class="constant-syntax">UNKNOWN_CE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">verb_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vf</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vi</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">first_form</span><span class="plain-syntax">; </span><span class="identifier-syntax">vf</span><span class="plain-syntax">; </span><span class="identifier-syntax">vf</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_form</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">verb_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vm</span><span class="plain-syntax"> = &amp;(</span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">list_of_senses</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">vm</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-vm.html#SP4" class="function-link"><span class="function-syntax">VerbMeanings::is_meaningless</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vm</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><a href="3-vu.html#SP13" class="function-link"><span class="function-syntax">VerbUsages::parse_against_verb</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">, </span><span class="identifier-syntax">vu</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (!((</span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;</span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;=</span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">)))) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1_1" class="named-paragraph-link"><span class="named-paragraph">Reject a match with verb in the wrong position</span><span class="named-paragraph-number">5.3.1.1.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1_2" class="named-paragraph-link"><span class="named-paragraph">Now we definitely have the verb usage at the front</span><span class="named-paragraph-number">5.3.1.1.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1_3" class="named-paragraph-link"><span class="named-paragraph">Check whether the rest of the verb form pans out</span><span class="named-paragraph-number">5.3.1.1.1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1">&#167;5.3.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1_1" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1.1. </b>A further complication is that we will reject this usage if it occurs
somewhere forbidden: for example, if a verb form is only allowed in an SVO
configuration, we will ignore it if <span class="extract"><span class="extract-syntax">TW</span></span> is the whole of <span class="extract"><span class="extract-syntax">W</span></span>, because then the
verb would begin at the first word of the sentence. Conversely, if it is only
allowed in an imperative VO configuration, it's required to be there.
</p>

<p class="commentary">In Inform, for example, "to carry" is an SVO verb, so we will match "Peter
carries the flash cards" but not "Carries Peter"; and "to test" is a VOO verb,
so we will match "Test me with flash cards" but not "Peter tests me with
flash cards".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Reject a match with verb in the wrong position</span><span class="named-paragraph-number">5.3.1.1.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_structures</span><span class="plain-syntax"> &amp; (</span><span class="identifier-syntax">VO_FS_BIT</span><span class="plain-syntax"> + </span><span class="identifier-syntax">VOO_FS_BIT</span><span class="plain-syntax">)) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax"> == </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_structures</span><span class="plain-syntax"> &amp; (</span><span class="constant-syntax">SVO_FS_BIT</span><span class="plain-syntax"> + </span><span class="identifier-syntax">SVOO_FS_BIT</span><span class="plain-syntax">)) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1_1">&#167;5.3.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1_2" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1.2. </b>So now we know that the verb definitely appears. We form <span class="extract"><span class="extract-syntax">ISW</span></span> as the
wording for the subject phrase and <span class="extract"><span class="extract-syntax">IOW</span></span> the object phrase. Adverbs of
certainty are removed from these.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Now we definitely have the verb usage at the front</span><span class="named-paragraph-number">5.3.1.1.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ISW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IOW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;pre-verb-certainty&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">ISW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pre_certainty</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ISW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;pre-verb-certainty&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;post-verb-certainty&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">IOW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">post_certainty</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IOW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;post-verb-certainty&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pre_certainty</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> == </span><span class="constant-syntax">UNKNOWN_CE</span><span class="plain-syntax">) </span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> = </span><span class="identifier-syntax">post_certainty</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SEEK_VP_TRACE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Found usage, pass %d tier %d: (%W) $w (%W)\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">pass</span><span class="plain-syntax">, </span><span class="identifier-syntax">tier</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">priority</span><span class="plain-syntax">, </span><span class="identifier-syntax">ISW</span><span class="plain-syntax">, </span><span class="identifier-syntax">vi</span><span class="plain-syntax">, </span><span class="identifier-syntax">IOW</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1_1">&#167;5.3.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1_3" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1.3. </b> If the verb form is, say, "place in ... with ...", and we have detected the
verb as "places" in the sentence "Henry places the cherry on the cake", we
still must reject this usage because it's missing the essential prepositions
"in" and "with". (It would, however, pass if the verb form were "place... on...".)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check whether the rest of the verb form pans out</span><span class="named-paragraph-number">5.3.1.1.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">SW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ISW</span><span class="plain-syntax">, </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IOW</span><span class="plain-syntax">, </span><span class="identifier-syntax">O2W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">VW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1_3_2" class="named-paragraph-link"><span class="named-paragraph">If we have recursed in an existential sentence, trim any which</span><span class="named-paragraph-number">5.3.1.1.1.3.2</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">preposition</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prep1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">preposition</span><span class="plain-syntax">, *</span><span class="identifier-syntax">req1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">prep1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">preposition</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prep2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">second_clause_preposition</span><span class="plain-syntax">, *</span><span class="identifier-syntax">req2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">prep2</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">last_preposition_position</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">existential</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">structures</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_structures</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1_3_1" class="named-paragraph-link"><span class="named-paragraph">A copular verb with a defective SP is existential</span><span class="named-paragraph-number">5.3.1.1.1.3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1_3_3" class="named-paragraph-link"><span class="named-paragraph">Check whether we do indeed have these required prepositions in place</span><span class="named-paragraph-number">5.3.1.1.1.3.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> we couldn't check for this before, since we need to skip past the prepositions too</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pass</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) &amp;&amp; (</span><span class="function-syntax">&lt;pre-verb-rc-marker&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">SW</span><span class="plain-syntax">))) { </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP5_3_1_1_1_3_4" class="named-paragraph-link"><span class="named-paragraph">Check whether any sense of this verb form will accept this usage and succeed if so</span><span class="named-paragraph-number">5.3.1.1.1.3.4</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1_1">&#167;5.3.1.1.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1_3_1" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1.3.1. </b>This is also where we detect whether we have an existential sentence such as
"There is a man in the Dining Room." If so, we will have to allow for the
preposition "in" to be divided from the verb "is". But we will first check
(by using our one level of recursion) whether the tail of the sentence makes
sense in its own right. In this example it doesn't, but for "There is a man
who is in the Dining Room" (note the additional "is"), it would.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">A copular verb with a defective SP is existential</span><span class="named-paragraph-number">5.3.1.1.1.3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">vi</span><span class="plain-syntax"> == </span><span class="identifier-syntax">copular_verb</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">req2</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="function-syntax">&lt;np-existential&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">SW</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;phrase-with-calling&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">last_preposition_position</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;phrase-with-calling&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><a href="4-vp.html#SP5" class="function-link"><span class="function-syntax">VerbPhrases::seek</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">, </span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="identifier-syntax">XP</span><span class="plain-syntax">, </span><span class="identifier-syntax">last_preposition_position</span><span class="plain-syntax">, </span><span class="identifier-syntax">detect_occurrences</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOG_OUTDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(*</span><span class="identifier-syntax">XP</span><span class="plain-syntax">, </span><span class="constant-syntax">sentence_is_existential_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">existential</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="identifier-syntax">structures</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SVOO_FS_BIT</span><span class="plain-syntax">; </span><span class="identifier-syntax">req1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">req2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">prep1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1_1_3">&#167;5.3.1.1.1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1_3_2" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1.3.2. </b>And that explains the following. If we have recursed on "There is a man
who is in the Dining Room" then we are currently looking at "a man who is in
the Dining Room", and have set the <span class="extract"><span class="extract-syntax">SW</span></span> wording to "a man who". We want to
trim away that "who" from the end of the <span class="extract"><span class="extract-syntax">SW</span></span>.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">If we have recursed in an existential sentence, trim any which</span><span class="named-paragraph-number">5.3.1.1.1.3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">existential_OP_edge</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="comment-syntax"> i.e., if we have recursed</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;pre-verb-rc-marker&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">SW</span><span class="plain-syntax">)) { </span><span class="comment-syntax"> there is indeed a "which" at the end of </span><span class="extract"><span class="extract-syntax">SW</span></span>
<span class="plain-syntax">            </span><span class="identifier-syntax">SW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;pre-verb-rc-marker&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">); </span><span class="comment-syntax"> so trim it off</span>
<span class="plain-syntax">        }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1_1_3">&#167;5.3.1.1.1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1_3_3" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1.3.3. </b>This part at least is boringly straightforward.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check whether we do indeed have these required prepositions in place</span><span class="named-paragraph-number">5.3.1.1.1.3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">usage_succeeds</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">req1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">usage_succeeds</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (!((</span><span class="identifier-syntax">req1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">allow_unexpected_upper_case</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Word::unexpectedly_upper_case</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">)))))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordAssemblages::is_at</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">req1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">prep_text</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">), </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">) + </span><span class="identifier-syntax">WordAssemblages::length</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">req1</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">prep_text</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">VW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">usage_succeeds</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">usage_succeeds</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">req2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">usage_succeeds</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax">=</span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">) + </span><span class="constant-syntax">1</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">last_preposition_position</span><span class="plain-syntax">; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">TOW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">, </span><span class="identifier-syntax">j</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">WordAssemblages::is_at</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">req2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">prep_text</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">TOW</span><span class="plain-syntax">), </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">TOW</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">j</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">existential</span><span class="plain-syntax">) </span><span class="identifier-syntax">SW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">, </span><span class="identifier-syntax">found</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">O2W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">, </span><span class="identifier-syntax">found</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">, </span><span class="identifier-syntax">found</span><span class="plain-syntax"> + </span><span class="identifier-syntax">WordAssemblages::length</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">req2</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">prep_text</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">usage_succeeds</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">usage_succeeds</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1_1_3">&#167;5.3.1.1.1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_3_1_1_1_3_4" class="paragraph-anchor"></a><b>&#167;5.3.1.1.1.3.4. </b>Now we're getting somewhere. The verb and any prepositions required by this
form are all in place, and we know this would be a meaningful sentence. So
we start building the diagram tree for the sentence at last, with the node
representing the verb.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check whether any sense of this verb form will accept this usage and succeed if so</span><span class="named-paragraph-number">5.3.1.1.1.3.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::new</span><span class="plain-syntax">(</span><span class="constant-syntax">VERB_NT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">certainty</span><span class="plain-syntax"> != </span><span class="constant-syntax">UNKNOWN_CE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="constant-syntax">verbal_certainty_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">certainty</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">vu</span><span class="plain-syntax">) </span><span class="identifier-syntax">Node::set_verb</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">vu</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Node::set_preposition</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">prep1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Node::set_second_preposition</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">prep2</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">Node::set_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">VW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">existential</span><span class="plain-syntax">) </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="constant-syntax">sentence_is_existential_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pre_certainty</span><span class="plain-syntax"> != </span><span class="constant-syntax">UNKNOWN_CE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">post_certainty</span><span class="plain-syntax"> != </span><span class="constant-syntax">UNKNOWN_CE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="constant-syntax">linguistic_error_here_ANNOT</span><span class="plain-syntax">, </span><span class="constant-syntax">TwoLikelihoods_LINERROR</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">detect_occurrences</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">time_period</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tp</span><span class="plain-syntax"> = </span><a href="3-apoo.html#SP9" class="function-link"><span class="function-syntax">Occurrence::parse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">tp</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><a href="3-apoo.html#SP5" class="function-link"><span class="function-syntax">Occurrence::unused_wording</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Node::set_occurrence</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">tp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_NPS_IN_VP</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[0] = </span><span class="identifier-syntax">SW</span><span class="plain-syntax">; </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[1] = </span><span class="identifier-syntax">OW</span><span class="plain-syntax">; </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[2] = </span><span class="identifier-syntax">O2W</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax"> = </span><a href="4-vp.html#SP7" class="function-link"><span class="function-syntax">VerbPhrases::accept</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vf</span><span class="plain-syntax">, </span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">XP</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SEEK_VP_TRACE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Accepted as $w + $p + $p\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">vi</span><span class="plain-syntax">, </span><span class="identifier-syntax">prep1</span><span class="plain-syntax">, </span><span class="identifier-syntax">prep2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SEEK_VP_TRACE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Rejected as $w + $p + $p\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">vi</span><span class="plain-syntax">, </span><span class="identifier-syntax">prep1</span><span class="plain-syntax">, </span><span class="identifier-syntax">prep2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP5_3_1_1_1_3">&#167;5.3.1.1.1.3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>This routine completes the sentence diagram by adding further nodes to
represent the subject and object phrases. How this is done depends on the
sense of the verb: for example, in Inform, "X is an activity" produces a
rather different subtree to "Peter is a man". What happens is that each
possible sense of the verb form (in this case "is" with no prepositions)
is tried in turn: each one is asked, in effect, do you want this sentence?
</p>

<p class="commentary">This is where, at last, special sentence meaning functions come into their
own: they are called with the task <span class="extract"><span class="extract-syntax">ACCEPT_SMFT</span></span> to see if they are willing
to accept this sentence, whose noun phrases are stored in the <span class="extract"><span class="extract-syntax">NPs</span></span> array.
If they do want it, they should build the necessary diagram and return <span class="extract"><span class="extract-syntax">TRUE</span></span>.
</p>

<p class="commentary">For example, the special meaning of "to mean" occurring in:
</p>

<blockquote>
    <p>Use American dialect means ...</p>
</blockquote>

<p class="commentary">will only accept a subject phrase beginning with the word "use". The power to
say no to <span class="extract"><span class="extract-syntax">ACCEPT_SMFT</span></span> thus enables us to minimise confusions between special
and regular meanings.
</p>

<p class="commentary">If all the special meanings decline, we can fall back on a regular meaning,
if there is one.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAX_NPS_IN_VP</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">VerbPhrases::accept</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::accept</span></span>:<br/><a href="4-vp.html#SP5_3_1_1_1_3_4">&#167;5.3.1.1.1.3.4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">verb_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vf</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> *</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">verb_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vm</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">verb_sense</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vs</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">vf</span><span class="plain-syntax">)?</span><span class="identifier-syntax">vf</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">list_of_senses:NULL</span><span class="plain-syntax">; </span><span class="identifier-syntax">vs</span><span class="plain-syntax">; </span><span class="identifier-syntax">vs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vs</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next_sense</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">vm</span><span class="plain-syntax"> = &amp;(</span><span class="identifier-syntax">vs</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">vm</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">special_meaning_holder</span><span class="plain-syntax"> *</span><span class="identifier-syntax">sm</span><span class="plain-syntax"> = </span><a href="3-vm.html#SP10" class="function-link"><span class="function-syntax">VerbMeanings::get_special_meaning</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vm</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sm</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_NPS_IN_VP</span><span class="plain-syntax">];</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-vm.html#SP10" class="function-link"><span class="function-syntax">VerbMeanings::get_reversal_status_of_smf</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vm</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">[0] = </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[1]; </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">[1] = </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[0]; </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">[2] = </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[2];</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">[0] = </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[0]; </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">[1] = </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[1]; </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">[2] = </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[2];</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-sm.html#SP8" class="function-link"><span class="function-syntax">SpecialMeanings::call</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">sm</span><span class="plain-syntax">, </span><span class="constant-syntax">ACCEPT_SMFT</span><span class="plain-syntax">, </span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">SNPs</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Node::set_special_meaning</span><span class="plain-syntax">(</span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">sm</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="3-vm.html#SP9" class="function-link"><span class="function-syntax">VerbMeanings::get_regular_meaning</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vm</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[0])) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[1])) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[2])) &amp;&amp;</span>
<span class="plain-syntax">        (</span><a href="4-vp.html#SP8" class="function-link"><span class="function-syntax">VerbPhrases::default_verb</span></a><span class="plain-syntax">(</span><span class="constant-syntax">ACCEPT_SMFT</span><span class="plain-syntax">, </span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">, </span><span class="identifier-syntax">vm</span><span class="plain-syntax">, </span><span class="identifier-syntax">NPs</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VP_PN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>In effect, this is the sentence meaning function for all regular meanings.
For example, "Darcy is proud" and "Darcy wears the hat" will both end up here.
It is only ever called for task <span class="extract"><span class="extract-syntax">ACCEPT_SMFT</span></span>, and it always accepts.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::default_verb</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::default_verb</span></span>:<br/><a href="4-vp.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">V</span><span class="plain-syntax">, </span><span class="reserved-syntax">verb_meaning</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vm</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> *</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">SW</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">)?(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[0]):</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">)?(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[1]):</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">task</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ACCEPT_SMFT:</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">verb_usage</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vu</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_verb</span><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">verb</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vsave</span><span class="plain-syntax"> = </span><span class="identifier-syntax">permitted_verb</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">permitted_verb</span><span class="plain-syntax"> = </span><a href="3-vu.html#SP12" class="function-link"><span class="function-syntax">VerbUsages::get_verb</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vu</span><span class="plain-syntax">);</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;np-as-object&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;np-as-object&gt; failed"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">O_PN</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;np-as-subject&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">SW</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;np-as-subject&gt; failed"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S_PN</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S_PN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">O_PN</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-vp.html#SP8_1" class="named-paragraph-link"><span class="named-paragraph">Insert a relationship subtree for the OP of a non-copular verb</span><span class="named-paragraph-number">8.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">            </span><span class="identifier-syntax">permitted_verb</span><span class="plain-syntax"> = </span><span class="identifier-syntax">vsave</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8_1" class="paragraph-anchor"></a><b>&#167;8.1. </b>See <a href="P-asd.html" class="internal">About Sentence Diagrams</a>: the OP for a non-copular verb becomes a
<span class="extract"><span class="extract-syntax">RELATIONSHIP_NT</span></span> subtree, with relation reversed so that it is given from
the point of view of the object, not the subject.
</p>

<p class="commentary">For example, in "Darcy wears the hat", the OP "the hat" becomes a
<span class="extract"><span class="extract-syntax">RELATIONSHIP_NT</span></span> subtree with the relation "is worn by" &mdash; from the hat's
point of view, it is being worn.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Insert a relationship subtree for the OP of a non-copular verb</span><span class="named-paragraph-number">8.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="constant-syntax">VERB_MEANING_LINGUISTICS_TYPE</span><span class="plain-syntax"> *</span><span class="identifier-syntax">meaning</span><span class="plain-syntax"> = </span><a href="3-vm.html#SP9" class="function-link"><span class="function-syntax">VerbMeanings::get_regular_meaning</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">vm</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">meaning</span><span class="plain-syntax"> != </span><span class="identifier-syntax">VERB_MEANING_EQUALITY</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><a href="1-dgr.html#SP7" class="function-link"><span class="function-syntax">Diagrams::new_RELATIONSHIP</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">), </span><a href="3-vm.html#SP2" class="function-link"><span class="function-syntax">VerbMeanings::reverse_VMT</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">meaning</span><span class="plain-syntax">), </span><span class="identifier-syntax">O_PN</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-vp.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Sidekick nonterminals.</b>We will want to spot adverbs of certainty adjacent to the verb itself;
English allows these either side, so "A man is usually happy" and "Peter
certainly is happy" are both possible. Note that these adverbs can divide
a verb from its preposition(s): consider "The rain in Spain lies mainly in
the plain", where "mainly" divides "lies" from "in".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;pre-verb-certainty&gt;</span>
<span class="plain-syntax">    ... </span><span class="function-syntax">&lt;certainty&gt;</span>

<span class="function-syntax">&lt;post-verb-certainty&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;certainty&gt;</span><span class="plain-syntax"> ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>Relative clauses ("a woman who is on the stage") are detected by the presence
of a marker word before the verb (in this example, "who"). Of course, such
a word doesn't always mean we have a relative clause, so we will need to be a
little careful using this nonterminal.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;rc-marker&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">which</span><span class="plain-syntax">/</span><span class="identifier-syntax">who</span><span class="plain-syntax">/</span><span class="identifier-syntax">that</span>

<span class="function-syntax">&lt;pre-verb-rc-marker&gt;</span>
<span class="plain-syntax">    ... </span><span class="function-syntax">&lt;rc-marker&gt;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>The following is used only in the reconstruction of existential sentences
such as "There is a cat called Puss in Boots", where we want to prevent the
"in" being considered a preposition &mdash; it is part of a calling-name.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;phrase-with-calling&gt;</span>
<span class="plain-syntax">    ... </span><span class="identifier-syntax">called</span><span class="plain-syntax"> ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Corrective surgery.</b>The following iterates until all possible surgeries have been done.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::corrective_surgery</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::corrective_surgery</span></span>:<br/><a href="4-vp.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">permit_of</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">Node::get_special_meaning</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">))?</span><span class="identifier-syntax">FALSE:TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rv</span><span class="plain-syntax">) </span><span class="identifier-syntax">rv</span><span class="plain-syntax"> = </span><a href="4-vp.html#SP12" class="function-link"><span class="function-syntax">VerbPhrases::corrective_surgery_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="identifier-syntax">permit_of</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::corrective_surgery_r</span><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">permit_of</span><span class="plain-syntax">, </span><span class="identifier-syntax">node_type_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">par</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (; </span><span class="identifier-syntax">p</span><span class="plain-syntax">; </span><span class="identifier-syntax">p</span><span class="plain-syntax">=</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">permit_of</span><span class="plain-syntax">) &amp;&amp; ((</span><span class="identifier-syntax">par</span><span class="plain-syntax"> != </span><span class="constant-syntax">CALLED_NT</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> != </span><span class="constant-syntax">2</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="4-vp.html#SP14" class="function-link"><span class="function-syntax">VerbPhrases::perform_of_surgery</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP15" class="function-link"><span class="function-syntax">VerbPhrases::perform_location_surgery</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP16" class="function-link"><span class="function-syntax">VerbPhrases::perform_called_surgery</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="4-vp.html#SP12" class="function-link"><span class="function-syntax">VerbPhrases::corrective_surgery_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">, </span><span class="identifier-syntax">permit_of</span><span class="plain-syntax">, </span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">))))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">n</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>"Of surgery" is needed to break nounphrases including the word "of".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;np-x-of-y&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">of</span><span class="plain-syntax"> ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::perform_of_surgery</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::perform_of_surgery</span></span>:<br/><a href="4-vp.html#SP12">&#167;12</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">) == </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">a</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::first_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)+1, </span><span class="identifier-syntax">b</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::last_wn</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)-1;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="identifier-syntax">a</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt;= </span><span class="identifier-syntax">b</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;np-x-of-y&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">Wordings::from</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">PW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Wordings::up_to</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;np-x-of-y&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP14" class="function-link"><span class="function-syntax">VerbPhrases::allow_of_surgery</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">PW</span><span class="plain-syntax">, </span><span class="identifier-syntax">OW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">Node::set_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="constant-syntax">X_OF_Y_NT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="function-syntax">&lt;np-articled&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="function-syntax">&lt;np-as-object&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">PW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::allow_of_surgery</span><span class="plain-syntax">(</span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">PW</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALLOW_OF_LINGUISTICS_CALLBACK</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALLOW_OF_LINGUISTICS_CALLBACK</span><span class="plain-syntax">(</span><span class="identifier-syntax">PW</span><span class="plain-syntax">, </span><span class="identifier-syntax">OW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifndef</span><span class="plain-syntax"> </span><span class="identifier-syntax">ALLOW_OF_LINGUISTICS_CALLBACK</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. </b>"Location surgery" is needed to make sentences like the second one here work:
</p>

<blockquote>
    <p>Anna is on the table and under the Ming Vase.</p>
</blockquote>

<p class="commentary">It performs a transformation on the tree like so:
</p>

<pre class="undisplayed-code all-displayed-code code-font">
<span class="identifier-syntax">Location</span><span class="plain-syntax"> </span><span class="identifier-syntax">surgery</span><span class="plain-syntax"> </span><span class="identifier-syntax">on:</span>
<span class="constant-syntax">RELATIONSHIP_NT</span><span class="character-syntax">'is on'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">meaning:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carries</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">AND_NT</span><span class="character-syntax">'and'</span>
<span class="plain-syntax">        </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'table'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">definite</span><span class="plain-syntax"> </span><span class="character-syntax">'the'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">/</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax">}</span>
<span class="plain-syntax">        </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="character-syntax">'under the ming vase'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">meaning:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carries</span><span class="plain-syntax">-</span><span class="identifier-syntax">reversed</span><span class="plain-syntax">}</span>
<span class="plain-syntax">            </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'ming vase'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">definite</span><span class="plain-syntax"> </span><span class="character-syntax">'the'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">/</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax">}</span>
<span class="identifier-syntax">Results</span><span class="plain-syntax"> </span><span class="identifier-syntax">in:</span>
<span class="constant-syntax">AND_NT</span><span class="character-syntax">'and'</span>
<span class="plain-syntax">    </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="character-syntax">'is on'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">meaning:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carries</span><span class="plain-syntax">}</span>
<span class="plain-syntax">        </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'table'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">definite</span><span class="plain-syntax"> </span><span class="character-syntax">'the'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">/</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax">}</span>
<span class="plain-syntax">    </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="character-syntax">'under the ming vase'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">meaning:</span><span class="plain-syntax"> </span><span class="identifier-syntax">carries</span><span class="plain-syntax">-</span><span class="identifier-syntax">reversed</span><span class="plain-syntax">}</span>
<span class="plain-syntax">        </span><span class="constant-syntax">UNPARSED_NOUN_NT</span><span class="character-syntax">'ming vase'</span><span class="plain-syntax"> {</span><span class="identifier-syntax">definite</span><span class="plain-syntax"> </span><span class="character-syntax">'the'</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">/</span><span class="identifier-syntax">m</span><span class="plain-syntax">/</span><span class="identifier-syntax">f</span><span class="plain-syntax"> </span><span class="identifier-syntax">s</span><span class="plain-syntax">/</span><span class="identifier-syntax">p</span><span class="plain-syntax"> </span><span class="identifier-syntax">nom</span><span class="plain-syntax">/</span><span class="identifier-syntax">acc</span><span class="plain-syntax">}</span>
</pre>
<p class="commentary">Looks easy, doesn't it? You will implement it wrongly the first six times you try.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::perform_location_surgery</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::perform_location_surgery</span></span>:<br/><a href="4-vp.html#SP12">&#167;12</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">old_and</span><span class="plain-syntax">, *</span><span class="identifier-syntax">old_np1</span><span class="plain-syntax">, *</span><span class="identifier-syntax">old_loc2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">) == </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">) == </span><span class="constant-syntax">AND_NT</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">) == </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SURGERY_VP_TRACE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Location surgery on:\n$T"</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">AW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">old_and</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">old_np1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">old_and</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">old_loc2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">old_and</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Node::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">old_and</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">); </span><span class="comment-syntax"> making this the new first location node</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Node::set_type_and_clear_annotations</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="constant-syntax">AND_NT</span><span class="plain-syntax">); </span><span class="comment-syntax"> and this is new AND</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Node::set_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="identifier-syntax">AW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax"> = </span><span class="identifier-syntax">old_and</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">old_and</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax"> = </span><span class="identifier-syntax">old_np1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">old_and</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">old_loc2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">old_np1</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SURGERY_VP_TRACE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Results in:\n$T"</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. Called surgery.</b>The following case is now, I believe, impossible, but once happened on phrases
like "north of a room called the Hot and Cold Room" where a <span class="extract"><span class="extract-syntax">CALLED_NT</span></span> and
a <span class="extract"><span class="extract-syntax">RELATIONSHIP_NT</span></span> had ended up the wrong way round. The code is retained
in case needed again in future.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VerbPhrases::perform_called_surgery</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">VerbPhrases::perform_called_surgery</span></span>:<br/><a href="4-vp.html#SP12">&#167;12</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">) == </span><span class="constant-syntax">CALLED_NT</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">) == </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SURGERY_VP_TRACE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Called surgery on:\n$T"</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">x_pn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">; </span><span class="comment-syntax"> "north" in the example</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name_pn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax">; </span><span class="comment-syntax"> "hot and cold room" in the example</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Node::set_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="constant-syntax">RELATIONSHIP_NT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Node::set_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">, </span><span class="constant-syntax">CALLED_NT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">x_pn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">name_pn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-vp.html#SP3" class="function-link"><span class="function-syntax">VerbPhrases::tracing</span></a><span class="plain-syntax">(</span><span class="constant-syntax">SURGERY_VP_TRACE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">LOG</span><span class="plain-syntax">(</span><span class="string-syntax">"Results in:\n$T"</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="4-np.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-lm.html">1</a></li><li class="progresschapter"><a href="2-adj.html">2</a></li><li class="progresschapter"><a href="3-vrb.html">3</a></li><li class="progresscurrentchapter">4</li><li class="progresssection"><a href="4-np.html">np</a></li><li class="progresscurrent">vp</li><li class="progressnextoff">&#10095;</li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

